<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="订单编号" prop="amazonOrderId">
        <el-input
          v-model="queryParams.amazonOrderId"
          placeholder="请输入订单编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商户编号" prop="merchantOrderId">
        <el-input
          v-model="queryParams.merchantOrderId"
          placeholder="请输入商户编号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="购买日期" prop="purchaseDate">
        <el-date-picker clearable size="small" style="width: 200px"
          v-model="queryParams.purchaseDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择购买日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="订单状态" prop="orderStatus">
        <el-select v-model="queryParams.orderStatus" placeholder="请选择订单状态" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <!--<el-form-item label="配送渠道" prop="salesChannel">-->
        <!--<el-input-->
          <!--v-model="queryParams.salesChannel"-->
          <!--placeholder="请输入配送渠道"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="订单渠道" prop="orderChannel">-->
        <!--<el-input-->
          <!--v-model="queryParams.orderChannel"-->
          <!--placeholder="请输入订单渠道"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="路径" prop="url">-->
        <!--<el-input-->
          <!--v-model="queryParams.url"-->
          <!--placeholder="请输入路径"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="配送服务类型" prop="shipServiceLevel">-->
        <!--<el-input-->
          <!--v-model="queryParams.shipServiceLevel"-->
          <!--placeholder="请输入配送服务类型"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <el-form-item label="产品名称" prop="productName">
        <el-input
          v-model="queryParams.productName"
          placeholder="请输入产品名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--<el-form-item label="最小存货单位" prop="sku">-->
        <!--<el-input-->
          <!--v-model="queryParams.sku"-->
          <!--placeholder="请输入最小存货单位"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <el-form-item label="ASIN码" prop="asin">
        <el-input
          v-model="queryParams.asin"
          placeholder="请输入ASIN码"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商品状态" prop="itemStatus">
        <el-select v-model="queryParams.itemStatus" placeholder="请选择商品状态" clearable size="small">
          <el-option label="请选择字典生成" value="" />
        </el-select>
      </el-form-item>
      <el-form-item label="数量" prop="quantity">
        <el-input
          v-model="queryParams.quantity"
          placeholder="请输入数量"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="货币" prop="currency">
        <el-input
          v-model="queryParams.currency"
          placeholder="请输入货币"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="商标价格" prop="itemPrice">
        <el-input
          v-model="queryParams.itemPrice"
          placeholder="请输入商标价格"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--<el-form-item label="项目税" prop="itemTax">-->
        <!--<el-input-->
          <!--v-model="queryParams.itemTax"-->
          <!--placeholder="请输入项目税"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="运费价格" prop="shippingPrice">-->
        <!--<el-input-->
          <!--v-model="queryParams.shippingPrice"-->
          <!--placeholder="请输入运费价格"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="运费税" prop="shippingTax">-->
        <!--<el-input-->
          <!--v-model="queryParams.shippingTax"-->
          <!--placeholder="请输入运费税"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="礼品包装价格" prop="giftWrapPrice">-->
        <!--<el-input-->
          <!--v-model="queryParams.giftWrapPrice"-->
          <!--placeholder="请输入礼品包装价格"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="礼品包装税" prop="giftWrapTax">-->
        <!--<el-input-->
          <!--v-model="queryParams.giftWrapTax"-->
          <!--placeholder="请输入礼品包装税"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="商品促销折扣" prop="itemPromotionDiscount">-->
        <!--<el-input-->
          <!--v-model="queryParams.itemPromotionDiscount"-->
          <!--placeholder="请输入商品促销折扣"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="运费促销折扣" prop="shipPromotionDiscount">-->
        <!--<el-input-->
          <!--v-model="queryParams.shipPromotionDiscount"-->
          <!--placeholder="请输入运费促销折扣"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <el-form-item label="货主地址" prop="shipCity">
        <el-input
          v-model="queryParams.shipCity"
          placeholder="请输入货主地址"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="邮递区号" prop="shipPostalCode">
        <el-input
          v-model="queryParams.shipPostalCode"
          placeholder="请输入邮递区号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--<el-form-item label="运输状态" prop="shipState">-->
        <!--<el-input-->
          <!--v-model="queryParams.shipState"-->
          <!--placeholder="请输入运输状态"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="运输国家" prop="shipCountry">-->
        <!--<el-input-->
          <!--v-model="queryParams.shipCountry"-->
          <!--placeholder="请输入运输国家"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="促销编号" prop="promotionIds">-->
        <!--<el-input-->
          <!--v-model="queryParams.promotionIds"-->
          <!--placeholder="请输入促销编号"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="业务订单" prop="isBusinessOrder">-->
        <!--<el-input-->
          <!--v-model="queryParams.isBusinessOrder"-->
          <!--placeholder="请输入业务订单"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="订购单号码" prop="purchaseOrderNumber">-->
        <!--<el-input-->
          <!--v-model="queryParams.purchaseOrderNumber"-->
          <!--placeholder="请输入订购单号码"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="客户信息表主键" prop="customerInformationId">-->
        <!--<el-input-->
          <!--v-model="queryParams.customerInformationId"-->
          <!--placeholder="请输入客户信息表主键"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="价格指定" prop="priceDesignation">-->
        <!--<el-input-->
          <!--v-model="queryParams.priceDesignation"-->
          <!--placeholder="请输入价格指定"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="创建人" prop="createdBy">-->
        <!--<el-input-->
          <!--v-model="queryParams.createdBy"-->
          <!--placeholder="请输入创建人"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="创建时间" prop="createdTime">-->
        <!--<el-date-picker clearable size="small" style="width: 200px"-->
          <!--v-model="queryParams.createdTime"-->
          <!--type="date"-->
          <!--value-format="yyyy-MM-dd"-->
          <!--placeholder="选择创建时间">-->
        <!--</el-date-picker>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="更新人" prop="lastUpdatedBy">-->
        <!--<el-input-->
          <!--v-model="queryParams.lastUpdatedBy"-->
          <!--placeholder="请输入更新人"-->
          <!--clearable-->
          <!--size="small"-->
          <!--@keyup.enter.native="handleQuery"-->
        <!--/>-->
      <!--</el-form-item>-->
      <!--<el-form-item label="更新时间" prop="lastUpdatedTime">-->
        <!--<el-date-picker clearable size="small" style="width: 200px"-->
          <!--v-model="queryParams.lastUpdatedTime"-->
          <!--type="date"-->
          <!--value-format="yyyy-MM-dd"-->
          <!--placeholder="选择更新时间">-->
        <!--</el-date-picker>-->
      <!--</el-form-item>-->
      <el-form-item>
        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['ymx:ymxorderinfo:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['ymx:ymxorderinfo:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['ymx:ymxorderinfo:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['ymx:ymxorderinfo:export']"
        >导出</el-button>
      </el-col>
	  
    <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="ymxorderinfoList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!--<el-table-column label="订单表主键" align="center" prop="orderId" />-->
      <el-table-column label="订单编号" align="center" prop="amazonOrderId" />
      <el-table-column label="商户编号" align="center" prop="merchantOrderId" />
      <el-table-column label="购买日期" align="center" prop="purchaseDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.purchaseDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="订单状态" align="center" prop="orderStatus" />
      <!--<el-table-column label="配送渠道" align="center" prop="salesChannel" />-->
      <!--<el-table-column label="订单渠道" align="center" prop="orderChannel" />-->
      <!--<el-table-column label="路径" align="center" prop="url" />-->
      <!--<el-table-column label="配送服务类型" align="center" prop="shipServiceLevel" />-->
      <el-table-column label="产品名称" align="center" prop="productName" />
      <!--<el-table-column label="最小存货单位" align="center" prop="sku" />-->
      <el-table-column label="ASIN码" align="center" prop="asin" />
      <el-table-column label="商品状态" align="center" prop="itemStatus" />
      <el-table-column label="数量" align="center" prop="quantity" />
      <el-table-column label="货币" align="center" prop="currency" />
      <el-table-column label="商标价格" align="center" prop="itemPrice" />
      <!--<el-table-column label="项目税" align="center" prop="itemTax" />-->
      <!--<el-table-column label="运费价格" align="center" prop="shippingPrice" />-->
      <!--<el-table-column label="运费税" align="center" prop="shippingTax" />-->
      <!--<el-table-column label="礼品包装价格" align="center" prop="giftWrapPrice" />-->
      <!--<el-table-column label="礼品包装税" align="center" prop="giftWrapTax" />-->
      <!--<el-table-column label="商品促销折扣" align="center" prop="itemPromotionDiscount" />-->
      <!--<el-table-column label="运费促销折扣" align="center" prop="shipPromotionDiscount" />-->
      <el-table-column label="货主地址" align="center" prop="shipCity" />
      <el-table-column label="邮递区号" align="center" prop="shipPostalCode" />
      <!--<el-table-column label="运输状态" align="center" prop="shipState" />-->
      <!--<el-table-column label="运输国家" align="center" prop="shipCountry" />-->
      <!--<el-table-column label="促销编号" align="center" prop="promotionIds" />-->
      <!--<el-table-column label="业务订单" align="center" prop="isBusinessOrder" />-->
      <!--<el-table-column label="订购单号码" align="center" prop="purchaseOrderNumber" />-->
      <!--<el-table-column label="客户信息表主键" align="center" prop="customerInformationId" />-->
      <!--<el-table-column label="价格指定" align="center" prop="priceDesignation" />-->
      <!--<el-table-column label="创建人" align="center" prop="createdBy" />-->
      <!--<el-table-column label="创建时间" align="center" prop="createdTime" width="180">-->
        <!--<template slot-scope="scope">-->
          <!--<span>{{ parseTime(scope.row.createdTime, '{y}-{m}-{d}') }}</span>-->
        <!--</template>-->
      <!--</el-table-column>-->
      <!--<el-table-column label="更新人" align="center" prop="lastUpdatedBy" />-->
      <!--<el-table-column label="更新时间" align="center" prop="lastUpdatedTime" width="180">-->
        <!--<template slot-scope="scope">-->
          <!--<span>{{ parseTime(scope.row.lastUpdatedTime, '{y}-{m}-{d}') }}</span>-->
        <!--</template>-->
      <!--</el-table-column>-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['ymx:ymxorderinfo:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['ymx:ymxorderinfo:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改订单对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="订单编号" prop="amazonOrderId">
          <el-input v-model="form.amazonOrderId" placeholder="请输入订单编号" />
        </el-form-item>
        <el-form-item label="商户编号" prop="merchantOrderId">
          <el-input v-model="form.merchantOrderId" placeholder="请输入商户编号" />
        </el-form-item>
        <el-form-item label="购买日期" prop="purchaseDate">
          <el-date-picker clearable size="small" style="width: 200px"
            v-model="form.purchaseDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="选择购买日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="订单状态">
          <el-radio-group v-model="form.orderStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <!--<el-form-item label="配送渠道" prop="salesChannel">-->
          <!--<el-input v-model="form.salesChannel" placeholder="请输入配送渠道" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="订单渠道" prop="orderChannel">-->
          <!--<el-input v-model="form.orderChannel" placeholder="请输入订单渠道" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="路径" prop="url">-->
          <!--<el-input v-model="form.url" placeholder="请输入路径" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="配送服务类型" prop="shipServiceLevel">-->
          <!--<el-input v-model="form.shipServiceLevel" placeholder="请输入配送服务类型" />-->
        <!--</el-form-item>-->
        <el-form-item label="产品名称" prop="productName">
          <el-input v-model="form.productName" placeholder="请输入产品名称" />
        </el-form-item>
        <!--<el-form-item label="最小存货单位" prop="sku">-->
          <!--<el-input v-model="form.sku" placeholder="请输入最小存货单位" />-->
        <!--</el-form-item>-->
        <el-form-item label="ASIN码" prop="asin">
          <el-input v-model="form.asin" placeholder="请输入ASIN码" />
        </el-form-item>
        <el-form-item label="商品状态">
          <el-radio-group v-model="form.itemStatus">
            <el-radio label="1">请选择字典生成</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item label="数量" prop="quantity">
          <el-input v-model="form.quantity" placeholder="请输入数量" />
        </el-form-item>
        <el-form-item label="货币" prop="currency">
          <el-input v-model="form.currency" placeholder="请输入货币" />
        </el-form-item>
        <el-form-item label="商标价格" prop="itemPrice">
          <el-input v-model="form.itemPrice" placeholder="请输入商标价格" />
        </el-form-item>
        <!--<el-form-item label="项目税" prop="itemTax">-->
          <!--<el-input v-model="form.itemTax" placeholder="请输入项目税" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="运费价格" prop="shippingPrice">-->
          <!--<el-input v-model="form.shippingPrice" placeholder="请输入运费价格" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="运费税" prop="shippingTax">-->
          <!--<el-input v-model="form.shippingTax" placeholder="请输入运费税" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="礼品包装价格" prop="giftWrapPrice">-->
          <!--<el-input v-model="form.giftWrapPrice" placeholder="请输入礼品包装价格" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="礼品包装税" prop="giftWrapTax">-->
          <!--<el-input v-model="form.giftWrapTax" placeholder="请输入礼品包装税" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="商品促销折扣" prop="itemPromotionDiscount">-->
          <!--<el-input v-model="form.itemPromotionDiscount" placeholder="请输入商品促销折扣" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="运费促销折扣" prop="shipPromotionDiscount">-->
          <!--<el-input v-model="form.shipPromotionDiscount" placeholder="请输入运费促销折扣" />-->
        <!--</el-form-item>-->
        <el-form-item label="货主地址" prop="shipCity">
          <el-input v-model="form.shipCity" placeholder="请输入货主地址" />
        </el-form-item>
        <el-form-item label="邮递区号" prop="shipPostalCode">
          <el-input v-model="form.shipPostalCode" placeholder="请输入邮递区号" />
        </el-form-item>
        <!--<el-form-item label="运输状态" prop="shipState">-->
          <!--<el-input v-model="form.shipState" placeholder="请输入运输状态" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="运输国家" prop="shipCountry">-->
          <!--<el-input v-model="form.shipCountry" placeholder="请输入运输国家" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="促销编号" prop="promotionIds">-->
          <!--<el-input v-model="form.promotionIds" placeholder="请输入促销编号" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="业务订单" prop="isBusinessOrder">-->
          <!--<el-input v-model="form.isBusinessOrder" placeholder="请输入业务订单" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="订购单号码" prop="purchaseOrderNumber">-->
          <!--<el-input v-model="form.purchaseOrderNumber" placeholder="请输入订购单号码" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="客户信息表主键" prop="customerInformationId">-->
          <!--<el-input v-model="form.customerInformationId" placeholder="请输入客户信息表主键" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="价格指定" prop="priceDesignation">-->
          <!--<el-input v-model="form.priceDesignation" placeholder="请输入价格指定" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="创建人" prop="createdBy">-->
          <!--<el-input v-model="form.createdBy" placeholder="请输入创建人" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="创建时间" prop="createdTime">-->
          <!--<el-date-picker clearable size="small" style="width: 200px"-->
            <!--v-model="form.createdTime"-->
            <!--type="date"-->
            <!--value-format="yyyy-MM-dd"-->
            <!--placeholder="选择创建时间">-->
          <!--</el-date-picker>-->
        <!--</el-form-item>-->
        <!--<el-form-item label="更新人" prop="lastUpdatedBy">-->
          <!--<el-input v-model="form.lastUpdatedBy" placeholder="请输入更新人" />-->
        <!--</el-form-item>-->
        <!--<el-form-item label="更新时间" prop="lastUpdatedTime">-->
          <!--<el-date-picker clearable size="small" style="width: 200px"-->
            <!--v-model="form.lastUpdatedTime"-->
            <!--type="date"-->
            <!--value-format="yyyy-MM-dd"-->
            <!--placeholder="选择更新时间">-->
          <!--</el-date-picker>-->
        <!--</el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listYmxorderinfo, getYmxorderinfo, delYmxorderinfo, addYmxorderinfo, updateYmxorderinfo, exportYmxorderinfo } from "@/api/ymx/ymxorderinfo";

export default {
  name: "Ymxorderinfo",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 订单表格数据
      ymxorderinfoList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        amazonOrderId: null,
        merchantOrderId: null,
        purchaseDate: null,
        orderStatus: null,
        salesChannel: null,
        orderChannel: null,
        url: null,
        shipServiceLevel: null,
        productName: null,
        sku: null,
        asin: null,
        itemStatus: null,
        quantity: null,
        currency: null,
        itemPrice: null,
        itemTax: null,
        shippingPrice: null,
        shippingTax: null,
        giftWrapPrice: null,
        giftWrapTax: null,
        itemPromotionDiscount: null,
        shipPromotionDiscount: null,
        shipCity: null,
        shipPostalCode: null,
        shipState: null,
        shipCountry: null,
        promotionIds: null,
        isBusinessOrder: null,
        purchaseOrderNumber: null,
        customerInformationId: null,
        priceDesignation: null,
        createdBy: null,
        createdTime: null,
        lastUpdatedBy: null,
        lastUpdatedTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        amazonOrderId: [
          { required: true, message: "订单编号不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询订单列表 */
    getList() {
      this.loading = true;
      listYmxorderinfo(this.queryParams).then(response => {
        this.ymxorderinfoList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        orderId: null,
        amazonOrderId: null,
        merchantOrderId: null,
        purchaseDate: null,
        orderStatus: "0",
        salesChannel: null,
        orderChannel: null,
        url: null,
        shipServiceLevel: null,
        productName: null,
        sku: null,
        asin: null,
        itemStatus: "0",
        quantity: null,
        currency: null,
        itemPrice: null,
        itemTax: null,
        shippingPrice: null,
        shippingTax: null,
        giftWrapPrice: null,
        giftWrapTax: null,
        itemPromotionDiscount: null,
        shipPromotionDiscount: null,
        shipCity: null,
        shipPostalCode: null,
        shipState: null,
        shipCountry: null,
        promotionIds: null,
        isBusinessOrder: null,
        purchaseOrderNumber: null,
        customerInformationId: null,
        priceDesignation: null,
        createdBy: null,
        createdTime: null,
        lastUpdatedBy: null,
        lastUpdatedTime: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.orderId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加订单";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const orderId = row.orderId || this.ids
      getYmxorderinfo(orderId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改订单";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.orderId != null) {
            updateYmxorderinfo(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("修改成功");
                this.open = false;
                this.getList();
              }
            });
          } else {
            addYmxorderinfo(this.form).then(response => {
              if (response.code === 200) {
                this.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              }
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const orderIds = row.orderId || this.ids;
      this.$confirm('是否确认删除订单编号为"' + orderIds + '"的数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return delYmxorderinfo(orderIds);
        }).then(() => {
          this.getList();
          this.msgSuccess("删除成功");
        }).catch(function() {});
    },
    /** 导出按钮操作 */
    handleExport() {
      const queryParams = this.queryParams;
      this.$confirm('是否确认导出所有订单数据项?', "警告", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning"
        }).then(function() {
          return exportYmxorderinfo(queryParams);
        }).then(response => {
          this.download(response.msg);
        }).catch(function() {});
    }
  }
};
</script>
